<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/23
 * Time: 9:30
 */

namespace app\api\controller\v1;

use app\api\validate\IDMustBePostiveInt;
use app\lib\exception\NotFoundException;
use app\lib\exception\BaseException;
use think\Controller;
use think\Exception;

class Banner extends Controller
{

    public function getBanner($id)
    {

        (new IDMustBePostiveInt())->goCheck();

        $banner = new \app\api\model\Banner();
        $info = $banner->getBannerById($id);
//        $info->hidden(['update_time','delete_time','items.id']);  隐藏字段

        if(!$info){
            throw new NotFoundException();
        }

        $c = config('img_prefix');

        return $info;
    }

    public function index(){
        return '1';
    }

}